External Exam Download Resources Web Applications Games Recycle Bin

CSS inline vs block

inline elements do not start on a new line, and only take up as much width as necessary.

block elements start on a new line, and take up the full width available (meaning they stretch to the left and right as far as they can).

inline.html

<style>
    
.beside{
  display: inline;        
}
    
</style>

<p>Paragraph elements are block elements by default.</p>

<p class="beside">Second paragraph, inline with ...</p>

<p class="beside">... the third paragraph.</p>